#define  _CRT_SECURE_NO_WARNINGS 1		
int* intersection(int* nums1, int nums1Size, int* nums2, int nums2Size, int* returnSize) {
    int len = (nums1Size > nums2Size) ? nums2Size : nums1Size;
    int* arr = (int*)malloc(sizeof(int) * (len));
    int arr2[1001] = { 0 };
    int i = 0;
    for (i = 0; i < nums1Size; i++)
    {
        for (int j = 0; j < nums2Size; j++)
        {
            if (nums1[i] == nums2[j])
                arr2[nums1[i]] = 1;
        }
    }
    int k = 0;
    for (int i = 0; i <= 1000; i++)
    {
        if (arr2[i] == 1)
            arr[k++] = i;
    }
    *returnSize = k;
    return arr;
}